﻿package engine.base.sim {
	
	/**
	* Static class available to access the base root SimSet and register 
	* objects with that set.
	* @author Jon Smelquist
	*/
	public class Sim {
		
		private static var _rootSet:SimSet;
		
		public static function getRootSet():SimSet {
			if (_rootSet == null)
				_rootSet = new SimSet();
			return _rootSet;
		}
		
		/**
		 * Find object with the specified name key.
		 * @param	name	Name reference the object is stored under.
		 * @return	The SimObject associated with that name
		 */
		public static function findObject(name:String):SimObject {
			return getRootSet().findObject(name);
		}
		
		/**
		 * Register the specified object under the given name. Note:
		 * Name can be set to null (to register the object under the root
		 * node but not allow lookup)
		 * @param	obj		Object to be registered
		 * @param	name	Name key to be registered under
		 */
		public static function registerObject(obj:SimObject, name:String):void {
			getRootSet().addObject(obj, name);
		}
	}
	
}